﻿using System;
using System.Runtime.CompilerServices;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using LiveCharts;
using LiveCharts.Charts;
using LiveCharts.Definitions.Points;
using LiveCharts.Dtos;
using LiveCharts.Wpf;
using LiveCharts.Wpf.Points;

internal class Class5 : PointView, IOhlcPointView, IChartPointView
{
    [CompilerGenerated]
    public Class2 method_0()
    {
        return this.class2_0;
    }

    [CompilerGenerated]
    public void method_1(Class2 class2_1)
    {
        this.class2_0 = class2_1;
    }

 
    public double Open { get; set; }

 
    public double High { get; set; }
 
    public double Close { get; set; }

 
    public double Low { get; set; }

 
    public double Width { get; set; }
 
    public double Left { get; set; }

 
    public double StartReference { get; set; }

    public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
    {
        base.ValidArea = new CoreRectangle(this.Left, this.High, this.Width, Math.Abs(this.High - this.Low));
        this.gcandleSeries_0 = (GCandleSeries)current.SeriesView;
        if (base.IsNew)
        {
            this.method_0().high = (this.StartReference);
            this.method_0().open = (this.StartReference);
            this.method_0().close = (this.StartReference);
            this.method_0().low=(this.StartReference);
            this.method_0().left=(this.Left);
            this.method_0().width=(this.Width);
            this.method_0().method_13(false, TimeSpan.Zero);
            if (base.DataLabel != null)
            {
                Canvas.SetTop(base.DataLabel, current.ChartLocation.Y);
                Canvas.SetLeft(base.DataLabel, current.ChartLocation.X);
            }
            if (this.gcandleSeries_0.ColoringRules == null)
            {
                if (this.Open <= this.Close)
                {
                    foreach (PathFigure value in this.method_0().method_12())
                    {
                        ((PathGeometry)this.gcandleSeries_0.Paths[0].Path_0.Data).Figures.Add(value);
                    }
                }
                else
                {
                    foreach (PathFigure value2 in this.method_0().method_12())
                    {
                        ((PathGeometry)this.gcandleSeries_0.Paths[1].Path_0.Data).Figures.Add(value2);
                    }
                }
            }
            else
            {
                for (int j = 0; j < this.gcandleSeries_0.ColoringRules.Count; j++)
                {
                    if (this.gcandleSeries_0.ColoringRules[j].Condition(current, previousDrawn))
                    {
                        PathFigureCollection figures = ((PathGeometry)this.gcandleSeries_0.Paths[j].Path_0.Data).Figures;
                        foreach (PathFigure value3 in this.method_0().method_12())
                        {
                            figures.Add(value3);
                        }
                        break;
                    }
                }
            }
            this.bool_0 = (this.Open <= this.Close);
        }
        this.method_0().width = (this.Width);
        this.method_0().left = (this.Left);
        this.method_0().open = (this.Open);
        this.method_0().high = (this.High);
        this.method_0().close = (this.Close);
        this.method_0().low = (this.Low);
        if (this.bool_0 != this.Open <= this.Close)
        {
            if (this.gcandleSeries_0.ColoringRules == null)
            {
                if (this.Open <= this.Close)
                {
                    foreach (PathFigure value4 in this.method_0().method_12())
                    {
                        ((PathGeometry)this.gcandleSeries_0.Paths[0].Path_0.Data).Figures.Remove(value4);
                        ((PathGeometry)this.gcandleSeries_0.Paths[1].Path_0.Data).Figures.Remove(value4);
                        ((PathGeometry)this.gcandleSeries_0.Paths[0].Path_0.Data).Figures.Add(value4);
                    }
                }
                else
                {
                    foreach (PathFigure value5 in this.method_0().method_12())
                    {
                        ((PathGeometry)this.gcandleSeries_0.Paths[0].Path_0.Data).Figures.Remove(value5);
                        ((PathGeometry)this.gcandleSeries_0.Paths[1].Path_0.Data).Figures.Remove(value5);
                        ((PathGeometry)this.gcandleSeries_0.Paths[1].Path_0.Data).Figures.Add(value5);
                    }
                }
            }
            else
            {
                for (int k = 0; k < this.gcandleSeries_0.ColoringRules.Count; k++)
                {
                    if (this.gcandleSeries_0.ColoringRules[k].Condition(current, previousDrawn))
                    {
                        PathFigureCollection figures2 = ((PathGeometry)this.gcandleSeries_0.Paths[k].Path_0.Data).Figures;
                        foreach (PathFigure value6 in this.method_0().method_12())
                        {
                            ShapesStroke[] paths = this.gcandleSeries_0.Paths;
                            for (int l = 0; l < paths.Length; l++)
                            {
                                ((PathGeometry)paths[l].Path_0.Data).Figures.Remove(value6);
                            }
                            figures2.Add(value6);
                        }
                        break;
                    }
                }
            }
            this.bool_0 = (this.Open <= this.Close);
        }
        if (chart.View.DisableAnimations)
        {
            this.method_0().method_13(false, TimeSpan.Zero);
            if (base.DataLabel != null)
            {
                base.DataLabel.UpdateLayout();
                double length = this.method_2(current.ChartLocation.X - base.DataLabel.ActualHeight * 0.5, chart);
                double length2 = this.method_3(current.ChartLocation.Y - base.DataLabel.ActualWidth * 0.5, chart);
                Canvas.SetTop(base.DataLabel, length2);
                Canvas.SetLeft(base.DataLabel, length);
            }
            return;
        }
        TimeSpan animationsSpeed = chart.View.AnimationsSpeed;
        if (base.DataLabel != null)
        {
            base.DataLabel.UpdateLayout();
            double toValue = this.method_2(current.ChartLocation.X - base.DataLabel.ActualWidth * 0.5, chart);
            double toValue2 = this.method_3(current.ChartLocation.Y - base.DataLabel.ActualHeight * 0.5, chart);
            base.DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(toValue, animationsSpeed));
            base.DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(toValue2, animationsSpeed));
        }
        this.method_0().method_13(true, animationsSpeed);
    }

    public override void RemoveFromView(ChartCore chart)
    {
        if (this.gcandleSeries_0 == null)
        {
            return;
        }
        foreach (PathFigure value in this.method_0().method_12())
        {
            ShapesStroke[] paths = this.gcandleSeries_0.Paths;
            for (int j = 0; j < paths.Length; j++)
            {
                ((PathGeometry)paths[j].Path_0.Data).Figures.Remove(value);
            }
        }
        chart.View.RemoveFromDrawMargin(base.DataLabel);
    }

    protected double method_2(double double_7, ChartCore chartCore_0)
    {
        if (double_7 + base.DataLabel.ActualWidth * 0.5 < -0.1)
        {
            return -base.DataLabel.ActualWidth;
        }
        if (double_7 + base.DataLabel.ActualWidth > chartCore_0.DrawMargin.Width)
        {
            double_7 -= double_7 + base.DataLabel.ActualWidth - chartCore_0.DrawMargin.Width + 2.0;
        }
        if (double_7 < 0.0)
        {
            double_7 = 0.0;
        }
        return double_7;
    }

    protected double method_3(double double_7, ChartCore chartCore_0)
    {
        if (double_7 + base.DataLabel.ActualHeight > chartCore_0.DrawMargin.Height)
        {
            double_7 -= double_7 + base.DataLabel.ActualHeight - chartCore_0.DrawMargin.Height + 2.0;
        }
        if (double_7 < 0.0)
        {
            double_7 = 0.0;
        }
        return double_7;
    }

    [CompilerGenerated]
    private Class2 class2_0;

    [CompilerGenerated]
    private double double_0;

    [CompilerGenerated]
    private double double_1;

    [CompilerGenerated]
    private double double_2;

    [CompilerGenerated]
    private double double_3;

    [CompilerGenerated]
    private double double_4;

    [CompilerGenerated]
    private double double_5;

    [CompilerGenerated]
    private double double_6;

    private bool bool_0;

    private GCandleSeries gcandleSeries_0;
}
